
function create_cdzb_tip(x,y)
    local x = x or 500
    local y = y or 200
    local ui = class.panel.create([[textures\black32.blp]],x,y,300,450)
    ui:set_level(99)
    ui:hide()
    ui.icon = ui:add_panel([[ReplaceableTextures\CommandButtons\BTNStaffOfSilence.blp]],20,20,64,64)
    ui.title = ui:add_text('荒古宝典[|cffff00ff史诗|r] +9',100,20,200,32,12,4)
    ui.quality = ui:add_text('T1',100,52,200,32,12,4)
    ui.tip = ui:add_text('',20,100,ui.w - 40,0,10)
    ui.line1 = ui:add_panel([[ReplaceableTextures\TeamColor\TeamColor10.blp]],20,10,ui.w - 40,3)
    ui.abi = ui:add_text('',20,100,ui.w - 40,0,10)

    ui.line2 = ui:add_panel([[ReplaceableTextures\TeamColor\TeamColor10.blp]],20,10,ui.w - 40,3)
    ui.tztp = ui:add_text('',20,100,ui.w - 40,0,10)

    function ui:set_tip(text,abi,tz)
        self.tip:set_text(text)
        self.abi:set_text(abi or '')
        self.tztp:set_text(tz)
        self.line1:set_position(self.line1.x,self.tip:get_height() + self.tip.y + 5)
        self.abi:set_position(self.abi.x,self.line1:get_height() + self.line1.y + 5)
        self.line2:set_position(self.abi.x,self.abi:get_height() + self.abi.y + 5)
        self.tztp:set_position(self.tztp.x,self.line2:get_height() + self.line2.y + 5)
        if abi then
            self.line1:show()
        else
            self.line1:hide()
        end
        if tz then
            self.line2:show()
        else
            self.line2:hide()
        end

        self:set_height(self.tztp:get_height() + self.tztp.y + 25)
    end

    function ui:set_data(info,ex)
        if info==nil then
            self:hide()
            return
        end
        local tip1 = format_obj(info, info.tip)
        local tip2 = format_obj(info, info.abi_tip)
        local art = format_obj(info, info.art)
        local title = format_obj(info, info.title)
        local tztp = get_cdtz_tip(info['前缀'])
        if ex then
            tztp = table.concat({tztp,ex})
        end
        self.icon:set_normal_image(art)
        self.title:set_text(title)
        self.quality:set_text(info['前缀'])
        self:set_tip(tip1,tip2,tztp)
        self:show()
    end

    return ui
end


local ui = create_cdzb_tip(200,350)
local text = [[
|cffff9900属性：|r
攻击速度+100%

|cff00ff00强化属性：|r
基础攻击+100
攻击速度+50%]]
local abi = [[
|cffff9900★毁灭:|r|n每次攻击敌人时，造成的伤害提高|cffff0000100|r%，最高叠加|cffff0000+50|r次。|n
|cffff9900★★神射手:|r|n远程英雄的|cffff9900攻击距离|r提升|cffff0000100|r码|n
|cffff9900★★★坚定:|r|n来自|cffff9900精英怪|r的|cffff0000伤害减少|r|cff00ff00100%|r。|n]]
local tz = [[T1套装(5/6)|n生命加成+3%|n生命加成+3%,攻击加成+4%|n生命加成+3%,攻击加成+4%,护甲加成+5]]

ui:set_tip(text,abi,tz)

local icon = class.panel.create('',0,0,ui.icon.w,ui.icon.h)
icon:set_level(100)

function icon:move_animation_finish()
    icon:hide()
end

ac.game:event 'UI-获得存档装备'(function(_,player,info)
    if player:is_self() then
        ui:set_data(info)
        ac.wait(3000,function()
            local x,y = ui.icon:get_real_position()
            ui:hide()
            icon:show()
            icon:set_position(x,y)
            icon:set_normal_image(info.art)
            icon:move_animation({250,50,80,80},0.5,'线性')
        end)
    end
end)

